<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller{
    public function head(){
        $this->display();
    }

    public function left(){
        $admin=new \Model\AdminModel();
        //获得管理员id
        $admin_id=session('admin_id');

        //获得管理员信息
        $info=$admin->find($admin_id);
        $role_id=$info['role_id'];

        //获得
        $role_info=D('Role')->find($role_id);
        $ids=$role_info['role_auth_ids'];

        if($info['name']=='admin'){
            $listA=D('Auth')->where("a_level=0")->select();
            $listB=D('Auth')->where("a_level=1")->select();
        }else{
            $listA=D('Auth')->where("a_id in ($ids) and a_level=0")->select();
            $listB=D('Auth')->where("a_id in ($ids) and a_level=1")->select();
        }


        $this->assign('listA',$listA);
        $this->assign('listB',$listB);

        $this->display();
    }

    public function right(){
        $this->display();
    }

    public function index(){
        $this->display();
    }
}